<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	
	<!-- TEMPLATE PRINCIPAL -->
	<xsl:template name="menuhorizontal">
		<xsl:param name="visible"/>		
		
		
		<xsl:if test="$visible='true'">
			<!--barra horizontal-->
			<div class="bg-menu-h corner">
				<div class="menu-h corner">
					<xsl:for-each select="//menuHorizontal">
						
						<xsl:for-each select="menuItem">
						
							<xsl:variable name="id"><xsl:value-of select="position()"/></xsl:variable>
							<xsl:choose>
								<xsl:when test="position()=1">
									<div class=" corner modulo item inicial" id="menu_modulo_{$id}" >
							
										<!-- menu -->
										<xsl:call-template name="modulo">
											<xsl:with-param name="id_modulo">menu_modulo_<xsl:value-of select="$id"/></xsl:with-param>
											<xsl:with-param name="id_submenu">submenu_modulo_<xsl:value-of select="$id"/></xsl:with-param>
										</xsl:call-template>				
									</div>
								
								</xsl:when>
								
								<xsl:otherwise>
									<div class=" corner modulo item" id="menu_modulo_{$id}" title="menu {$id}">
							
										<!-- menu -->
										<xsl:call-template name="modulo">
											<xsl:with-param name="id_modulo">menu_modulo_<xsl:value-of select="$id"/></xsl:with-param>
											<xsl:with-param name="id_submenu">submenu_modulo_<xsl:value-of select="$id"/></xsl:with-param>
										</xsl:call-template>
										
										
														
									</div>
								
								
								</xsl:otherwise>
							
							</xsl:choose>
							
						
							
						</xsl:for-each>
					</xsl:for-each>
						
					<!-- item final -->
					<div class="corner modulo final">
						&#160;
					</div>
					
					<div class="clearboth">&#160;</div>
				</div>	
			</div>
			
				
			
		</xsl:if>
		
	</xsl:template>
	
	<xsl:template name="modulo">
		<xsl:param name="id_modulo"/>
		<xsl:param name="id_submenu"/>
		
		<!-- modulo -->
		<xsl:for-each select="Modulo">
				<div class="corner menu-h-item  tooltip_menu_horizontal"  onClick="toogleSubmenuHorizontal('{$id_modulo}','{$id_submenu}');" title="menu {$id_modulo}" >
					<a><xsl:value-of select="modulo_nomb"></xsl:value-of></a>
					
				</div>
		</xsl:for-each>
		
		<!-- submenus -->
		<xsl:call-template name="submenu">
			<xsl:with-param name="id"><xsl:value-of select="$id_submenu"/></xsl:with-param>
		</xsl:call-template>
			
	
	</xsl:template>
	
	<xsl:template name="submenu">
		<xsl:param name="id"/>
		<!-- submenus -->
		<div id="{$id}" class="corner submenu-h corner" style="display:none;">
		<xsl:for-each select="Servicio">
			
			<xsl:choose>
				<xsl:when test="position()=1 and position()!=last()">
					<a class=" submenu-h-item inicial"   onclick="osm_go('{surl_url}');"><xsl:value-of select="concat('>', ' ', servicio_nomb)"></xsl:value-of></a>
				</xsl:when>
				
				<xsl:when test="position()=last() and position()=1">
					<a class=" submenu-h-item inicial final"   onclick="osm_go('{surl_url}');"><xsl:value-of select="concat('>', ' ', servicio_nomb)"></xsl:value-of></a>
				</xsl:when>
				
				<xsl:when test="position()!=last()">
					<a class="submenu-h-item"   onclick="osm_go('{surl_url}');"><xsl:value-of select="concat('>', ' ', servicio_nomb)"></xsl:value-of></a>
			
				</xsl:when>
				 
				<xsl:when test="position()=last() and position()!=1">
					<a class=" submenu-h-item final"   onclick="osm_go('{surl_url}');"><xsl:value-of select="concat('>', ' ', servicio_nomb)"></xsl:value-of></a>
			
				</xsl:when>
				
			
			
			</xsl:choose>
			
		</xsl:for-each>
		</div>	
	
	</xsl:template>
	
	
	<xsl:template match="menuHorizontal">
	</xsl:template>
	
	
</xsl:stylesheet>